/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package model.impl;

import model.Episode;
import model.EpisodesPackEpisode;
import model.ModelPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Episode</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link model.impl.EpisodeImpl#getEpisodesPackEpisode <em>Episodes Pack Episode</em>}</li>
 *   <li>{@link model.impl.EpisodeImpl#getPath <em>Path</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EpisodeImpl extends EntityDescriptionImpl implements Episode {
	/**
	 * The cached value of the '{@link #getEpisodesPackEpisode() <em>Episodes Pack Episode</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEpisodesPackEpisode()
	 * @generated
	 * @ordered
	 */
	protected EpisodesPackEpisode episodesPackEpisode;

	/**
	 * The default value of the '{@link #getPath() <em>Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPath()
	 * @generated
	 * @ordered
	 */
	protected static final String PATH_EDEFAULT = null;
	/**
	 * The cached value of the '{@link #getPath() <em>Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPath()
	 * @generated
	 * @ordered
	 */
	protected String path = PATH_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EpisodeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.EPISODE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EpisodesPackEpisode getEpisodesPackEpisode() {
		if (episodesPackEpisode != null && episodesPackEpisode.eIsProxy()) {
			InternalEObject oldEpisodesPackEpisode = (InternalEObject)episodesPackEpisode;
			episodesPackEpisode = (EpisodesPackEpisode)eResolveProxy(oldEpisodesPackEpisode);
			if (episodesPackEpisode != oldEpisodesPackEpisode) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.EPISODE__EPISODES_PACK_EPISODE, oldEpisodesPackEpisode, episodesPackEpisode));
			}
		}
		return episodesPackEpisode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EpisodesPackEpisode basicGetEpisodesPackEpisode() {
		return episodesPackEpisode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetEpisodesPackEpisode(EpisodesPackEpisode newEpisodesPackEpisode, NotificationChain msgs) {
		EpisodesPackEpisode oldEpisodesPackEpisode = episodesPackEpisode;
		episodesPackEpisode = newEpisodesPackEpisode;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelPackage.EPISODE__EPISODES_PACK_EPISODE, oldEpisodesPackEpisode, newEpisodesPackEpisode);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEpisodesPackEpisode(EpisodesPackEpisode newEpisodesPackEpisode) {
		if (newEpisodesPackEpisode != episodesPackEpisode) {
			NotificationChain msgs = null;
			if (episodesPackEpisode != null)
				msgs = ((InternalEObject)episodesPackEpisode).eInverseRemove(this, ModelPackage.EPISODES_PACK_EPISODE__EPISODE, EpisodesPackEpisode.class, msgs);
			if (newEpisodesPackEpisode != null)
				msgs = ((InternalEObject)newEpisodesPackEpisode).eInverseAdd(this, ModelPackage.EPISODES_PACK_EPISODE__EPISODE, EpisodesPackEpisode.class, msgs);
			msgs = basicSetEpisodesPackEpisode(newEpisodesPackEpisode, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.EPISODE__EPISODES_PACK_EPISODE, newEpisodesPackEpisode, newEpisodesPackEpisode));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getPath() {
		return path;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPath(String newPath) {
		String oldPath = path;
		path = newPath;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.EPISODE__PATH, oldPath, path));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ModelPackage.EPISODE__EPISODES_PACK_EPISODE:
				if (episodesPackEpisode != null)
					msgs = ((InternalEObject)episodesPackEpisode).eInverseRemove(this, ModelPackage.EPISODES_PACK_EPISODE__EPISODE, EpisodesPackEpisode.class, msgs);
				return basicSetEpisodesPackEpisode((EpisodesPackEpisode)otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ModelPackage.EPISODE__EPISODES_PACK_EPISODE:
				return basicSetEpisodesPackEpisode(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.EPISODE__EPISODES_PACK_EPISODE:
				if (resolve) return getEpisodesPackEpisode();
				return basicGetEpisodesPackEpisode();
			case ModelPackage.EPISODE__PATH:
				return getPath();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.EPISODE__EPISODES_PACK_EPISODE:
				setEpisodesPackEpisode((EpisodesPackEpisode)newValue);
				return;
			case ModelPackage.EPISODE__PATH:
				setPath((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.EPISODE__EPISODES_PACK_EPISODE:
				setEpisodesPackEpisode((EpisodesPackEpisode)null);
				return;
			case ModelPackage.EPISODE__PATH:
				setPath(PATH_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.EPISODE__EPISODES_PACK_EPISODE:
				return episodesPackEpisode != null;
			case ModelPackage.EPISODE__PATH:
				return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (path: ");
		result.append(path);
		result.append(')');
		return result.toString();
	}

} //EpisodeImpl
